<?php
namespace app\admin\controller;
use app\admin\controller\Base;
use app\admin\model\Sys as SysModel;
use think\Db;
class Sys extends Base
{
    //站点设置
    public function site()
    {
        if(request()->isAjax()){
            $shujv = input('post.');
            $result = Db::name('site')->where(array('id'=>1))->update($shujv);
            if($result===false){
                exit(json_encode(array('status'=>'n','info'=>'数据修改失败!')));
            }else{
                exit(json_encode(array('status'=>'y','info'=>'数据修改成功!')));
            }
        }else{
            $site = Db::name('site')->select();
            $this->assign('site',$site);
        }
        return view();
    }
    //logo
    public function logo()
    {
        if(request()->isAjax()){
            $shujv = input('post.');
            $result = Db::name('logo')->where(array('id'=>1))->update($shujv);
            if($result===false){
                exit(json_encode(array('status'=>'n','info'=>'数据修改失败!')));
            }else{
                exit(json_encode(array('status'=>'y','info'=>'数据修改成功!')));
            }
        }else{
            $logo = Db::name('logo')->select();
            $this->assign('logo',$logo);
        }
        return view();
    }
}